import {createHashRouter, Navigate} from "react-router-dom";
import PrivateRoute from "./privateRoute";
import Login from "@/views/login.tsx";
import Home from "@/views/home.tsx";
import CarInsuranceList from "@/views/policyManagement/CarInsuranceList.tsx";
import NoCarInsuranceList from "../views/policyManagement/NoCarInsuranceList.tsx";
import CarInsuranceDetails from "../views/policyManagement/CarInsuranceDetails.tsx";
import ProductLibraryList from "@/views/productManagement/ProductLibrary/list.tsx";
import ProductionAdd from "@/views/productManagement/ProductLibrary/productionAdd.tsx";
import Application from "@/views/OAExamine/Application.tsx";
import MineTask from "@/views/oaApproval/MineTask.tsx";
import MineTcase from "@/views/oaApproval/MineTcase.tsx";
import MineHistory from "@/views/oaApproval/MineHistory.tsx";
import ViewsForm from "@/views/OAExamine/ViewsForm.tsx";
import ViewForm from "@/views/OAExamine/ViewForm.tsx";
import OrganInfo from "@/views/organManage/OrganInfo.tsx";
import OrganAdd from "@/views/organManage/OrganAdd.tsx";
// 定义路由类型 (使用内置的 RouteObject 类型)
const routes: [] = [
    {
        path: "/login",
        element: <Login />,
        hidden:true
        // errorElement: <ErrorPage / >,
    },
    {
        path: "/",
        element: <PrivateRoute><Home /></PrivateRoute>,
        name:'index',
        children: [
            {
                path: "/OAExamine/MineTask",
                name: '我的申请',
                menuName: 'OA审批',
                element: <MineTask />,
                icon: 'OA审批'
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/OAExamine/MineTcase",
                name: '我的任务',
                menuName: 'OA审批',
                element: <MineTcase />,
                icon: 'OA审批'
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/OAExamine/MineHistory",
                name: '我的历史',
                menuName: 'OA审批',
                element: <MineHistory />,
                icon: 'OA审批'
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/OAExamine/ViewsForm",
                name: '审批',
                menuName: 'OA审批',
                element: <ViewsForm />,
                icon: 'OA审批',
                hidden: true,
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/OAExamine/ViewForm",
                name: '查看表单',
                menuName: 'OA审批',
                element: <ViewForm />,
                icon: 'OA审批',
                hidden: true,
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/organManage",
                name: '机构信息',
                menuName: '机构管理',
                element: <OrganInfo />,
                icon: '保单管理'
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/organAdd",
                name: '机构新增',
                menuName: '机构管理',
                element: <OrganAdd />,
                icon: '保单管理',
                hidden:true,
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/CarInsuranceList",
                name:'车险保单',
                menuName: '保单列表',
                element: <CarInsuranceList />,
                icon:'保单管理'
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/CarInsuranceDetails",
                name: '车险保单明细',
                menuName: '保单列表',
                element: <CarInsuranceDetails />,
                hidden:true,
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/NoCarInsuranceList",
                menuName: '保单列表',
                element: <NoCarInsuranceList />,
                name: '非车险保单',
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/ProductLibraryList",
                name: '产品库',
                menuName: '产品管理',
                element: <ProductLibraryList />,
                icon: '产品管理'
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/ProductionAdd",
                name: '新增保险产品',
                menuName: '产品管理',
                element: <ProductionAdd />,
                icon: '产品管理',
                hidden:true,
                // errorElement: <ErrorPage / >,
            },
            {
                path: "/OAExamine/Application",
                name: '发起申请',
                menuName: 'OA审批',
                element: <Application />,
                icon: '产品管理',
                hidden: true,
                // errorElement: <ErrorPage / >,
            },
        ]
        // errorElement: <ErrorPage / >,
    },
];

// 创建 hash 路由
const router = createHashRouter(routes);
export default router;
